const fse = require('fs-extra');
const path = require("path");

const output = 'dist/ncc'

const patterns = [
    {
        // 从public中复制文件
        from: path.resolve(__dirname, 'public'),
        // 把复制的文件存放到dis里面
        to: path.resolve(__dirname, output, 'public')
    },
    {
        // 从public中复制文件
        from: path.resolve(__dirname, 'views'),
        // 把复制的文件存放到dis里面
        to: path.resolve(__dirname, output, 'views')
    }
]

patterns.forEach(item => {
    try {
        fse.copySync(item.from, item.to, { overwrite: true | false })
        console.log(`copy ${item.from} to ${item.to} success!`)
    } catch (err) {
        console.error(err)
    }
})